package com.xplay.xpocker.service.gaming.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xplay.xpocker.entity.GameRuMahjongOpenDeal;
import com.xplay.xpocker.mapper.GameRuMahjongOpenDealMapper;
import com.xplay.xpocker.service.gaming.GameRuMahjongOpenDealService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xplay
 * @since 2023-08-19
 */
@Service
public class GameRuMahjongOpenDealServiceImpl extends ServiceImpl<GameRuMahjongOpenDealMapper, GameRuMahjongOpenDeal> implements GameRuMahjongOpenDealService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void cleanRoomInfo(BigDecimal roomId) {
        remove(Wrappers.<GameRuMahjongOpenDeal>lambdaQuery().eq(GameRuMahjongOpenDeal::getRoomId, roomId));
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void cleanByUserId(BigDecimal uid) {
        remove(Wrappers.<GameRuMahjongOpenDeal>lambdaQuery().eq(GameRuMahjongOpenDeal::getSourceUserId, uid));
    }
}
